package com.ntschy.taizhou.service1;

import com.ntschy.taizhou.dao.HelloListDao;
import com.ntschy.taizhou.entity.TestUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserTansService {


    @Autowired
    HelloListDao helloListDao;
    @Autowired
    UserTansService2 userTansService2;

    @Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRES_NEW)
    public Object insertUser1(TestUser testUser) {
//        System.out.println("UserTansService-----"+TransactionSynchronizationManager.getCurrentTransactionName());
//        System.out.println( "UserTansService-----"+ TransactionSynchronizationManager.getCurrentTransactionIsolationLevel());
       // int a=1/0;
      // System.out.println(testUser.toString());
      helloListDao.insertUser(testUser);

        return "新增成功";

    }
}
